home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 8 / Night Owl CD-ROM (NOPV8) (Night Owl Publisher) (1993).ISO / 047a / lex_yacc.arj / EXPRLEX.L < prev    next >
Text File  |  1989-11-21  |  472b  |  27 lines

  1.  
  2.   (* EXPRLEX.L: lexical analyzer for EXPR.Y *)
  3.   {$I expr.h}
  4.  
  5. digit        [0-9]
  6. real        {digit}+(\.{digit}+)?([Ee][+\-]?{digit}+)?
  7.  
  8. %%
  9.  
  10.  var result : integer;
  11.  
  12. {real}        begin
  13.           val(yytext, yylval.number, result);
  14.           if result=0 then
  15.             return(NUMBER)
  16.           else
  17.             return(ILLEGAL)
  18.         end;
  19.  
  20. [a-zA-Z]    begin
  21.           yylval.variable := succ(ord(upcase(yytext[1]))-ord('A'));
  22.           return(VARIABLE)
  23.         end;
  24. ^\.        return(EOF);
  25. .        |
  26. \n        return(ord(yytext[1]));
  27.